package com.foreveross.framework.example.tags;

import freemarker.template.Configuration;
import freemarker.template.Version;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;

import javax.servlet.ServletContext;
import java.io.IOException;

@org.springframework.context.annotation.Configuration
public class FreemarkerConfiguration {

  @Autowired
  private ServletContext servletContext;

  @Bean
  public Configuration freemarkerConfigurer() throws IOException {
    Configuration configurer = new Configuration(new Version("2.3.23"));
    configurer.setServletContextForTemplateLoading(servletContext, "templates");
    return configurer;
  }

}
